package com.guys8.cemsbackend.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guys8.cemsbackend.entity.Inschool;
import com.guys8.cemsbackend.mapper.OutschoolMapper;
import com.guys8.cemsbackend.entity.Outschool;
import com.guys8.cemsbackend.service.OutschoolService;
import com.guys8.cemsbackend.utils.Others.ListUtil;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * (Outschool)表服务实现类
 *
 * @author breeze
 * @since 2022-08-24 16:53:22
 */
@Service("outschoolService")
public class OutschoolServiceImpl extends ServiceImpl<OutschoolMapper, Outschool> implements OutschoolService {

    public Outschool getusernowOut(Integer userid){
        Map<String,Object> accountMap = new HashMap<>();
        accountMap.put("user_id",userid);
        List<Outschool> outschools = listByMap(accountMap);
        if(outschools.size()==0) return null;
        return outschools.get(outschools.size()-1);
    }

    public List<Outschool> getallById(Integer userId) {
        Map<String,Object> accountMap = new HashMap<>();
        accountMap.put("user_id",userId);
        return ListUtil.getOppoList(listByMap(accountMap));
    }

}

